package com.djsearch.adapter;

import java.util.List;

import com.djsearch.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class WanNengParentListAdapter extends BaseAdapter{

	private Context mContext;
	private List<String> sortList;
	public WanNengParentListAdapter(Context context,List<String> sortList){
		mContext = context;
		this.sortList = sortList;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return sortList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return sortList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public void refresh(List<String> sortList) {
		this.sortList = sortList;
		notifyDataSetChanged();
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		convertView = LayoutInflater.from(mContext).inflate(
				R.layout.wanneng_search_parentlist_item, null);// 用LayoutInflater装载布局。
		TextView parentText = (TextView)convertView.findViewById(R.id.parentText);
		parentText.setText(sortList.get(position));
		return convertView;
	}

}
